﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Shell;
using Microsoft.Phone.Controls;
using C1.Util;

namespace ControlExplorer.Controls.RichTextBox
{
    public partial class RichTextBoxFormatting : UserControl, IExposeApplicationBarItems
    {
        ApplicationBarIconButton btnFormat = new ApplicationBarIconButton(new Uri("/Resources/AppBar/brush.png", UriKind.Relative));

        public RichTextBoxFormatting()
        {
            InitializeComponent();

            btnFormat.Text = "format";
            btnFormat.Click += btnFormat_Click;

            // set FormatPopup properties
            FormatPopup.RichTextBox = rtb;
            FormatPopup.Popup = Popup;
        }

        void btnFormat_Click(object sender, EventArgs e)
        {
            // show format popup
            Popup.IsOpen = true;
        }

        public IEnumerable<Microsoft.Phone.Shell.IApplicationBarMenuItem> ApplicationBarItems
        {
            get
            {
                yield return btnFormat;
            }
        }
    }
}
